﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ANZ_AIM_GUI.Utils;
using ANZ_AIM_DAL;
using ANZ_AIM_BLL;
using ANZ_AIM_BLL.Model;
using log4net;

namespace ANZ_AIM_GUI
{
    public partial class frmDataUpload : Form
    {
        //log4net
        private static readonly ILog logger = LogManager.GetLogger(typeof(frmDataUpload));

        public Dictionary<string, string> Candidate_FieldLabelDict { get; set; }
        public frmDataUpload()
        {
            InitializeComponent();

        }

        public frmDataUpload(string batchFileID)
            : this()
        {
            try
            {
                BuildCandidateLabel();

                CandidateBLL candidateBll = new CandidateBLL();
                DataTable dt = candidateBll.GetByBatchFileID(batchFileID);

                dgvData.DataSource = null;
                dgvData.Columns.Clear();
                dgvData.DataSource = dt;
                dgvData.AutoResizeColumns();

                PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(typeof(Candidate));
                foreach (PropertyDescriptor prop in properties)
                {
                    dgvData.Columns[prop.Name].HeaderText = Candidate_FieldLabelDict[prop.Name];
                } 
            }
            catch (Exception ex) { throw ex; }
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        public void BuildCandidateLabel()
        {
            try
            {
                Candidate_FieldLabelDict = new Dictionary<string, string>();
                Candidate_FieldLabelDict.Add("ID", "ID");
                Candidate_FieldLabelDict.Add("CVCode", "CV Code");
                Candidate_FieldLabelDict.Add("Channel", "Channel");
                Candidate_FieldLabelDict.Add("Team", "Team");
                Candidate_FieldLabelDict.Add("FullName_E", "FullName_E");
                Candidate_FieldLabelDict.Add("FullName_V", "FullName_V");
                Candidate_FieldLabelDict.Add("CellPhone", "CellPhone");
                Candidate_FieldLabelDict.Add("DateOfBirth", "Date Of Birth");
                Candidate_FieldLabelDict.Add("College", "College");
                Candidate_FieldLabelDict.Add("Qualification", "Qualification");
                Candidate_FieldLabelDict.Add("IDNumber", "ID Number");
                Candidate_FieldLabelDict.Add("IssuedDate", "Issued Date");
                Candidate_FieldLabelDict.Add("IssuedPlace", "Issued Place");
                Candidate_FieldLabelDict.Add("PermanentAddress", "Permanent Address");
                Candidate_FieldLabelDict.Add("Interviewer", "Interviewer");
                Candidate_FieldLabelDict.Add("InterviewDate", "Interview Date");
                Candidate_FieldLabelDict.Add("TrainingCallStatus", "Training Call Status");
                Candidate_FieldLabelDict.Add("TrainingCallStatusRemarks", "Training Call Status Remarks");

                Candidate_FieldLabelDict.Add("CICSanctionDeliveryDate", "CIC Sanction Delivery Date");
                Candidate_FieldLabelDict.Add("CICSanctionDelivererName", "CIC Sanction Deliverer Name");
                Candidate_FieldLabelDict.Add("CICResult", "CIC Result");
                Candidate_FieldLabelDict.Add("SanctionResult", "Sanction Result");
                Candidate_FieldLabelDict.Add("PECCheckResult", "PEC Check Result");
                Candidate_FieldLabelDict.Add("PECRemarks", "PEC Remarks");

                Candidate_FieldLabelDict.Add("TrainingBatch", "Training Batch");
                Candidate_FieldLabelDict.Add("TrainingDate", "Training Date");
                Candidate_FieldLabelDict.Add("TrainerName", "Trainer Name");
                Candidate_FieldLabelDict.Add("TrainingAttendance", "Training Attendance");
                Candidate_FieldLabelDict.Add("TrainingAttendanceRemarks", "Training Attendance Remarks");
                Candidate_FieldLabelDict.Add("ReTest", "Re Test");
                Candidate_FieldLabelDict.Add("ReTestRequirement", "Re Test Requirement");
                Candidate_FieldLabelDict.Add("TrainingResult", "Training Result");

                Candidate_FieldLabelDict.Add("OBEligible", "OBEligible");
                Candidate_FieldLabelDict.Add("DocumentCompletion", "Document Completion");
                Candidate_FieldLabelDict.Add("DocumentIncompletionRemarks", "Document Incompletion Remarks");
                Candidate_FieldLabelDict.Add("PCReceiptSubmissionDate", "PC Receipt Submission Date");
                Candidate_FieldLabelDict.Add("PCReportSubmissionDate", "PC Report Submission Date");

                Candidate_FieldLabelDict.Add("HiringManagerName", "Hiring Manager Name");
                Candidate_FieldLabelDict.Add("HiringManagerAcknowledgeDate", "Hiring Manager Acknowledge Date");
                Candidate_FieldLabelDict.Add("DelegateApproverName", "Delegate Approver Name");
                Candidate_FieldLabelDict.Add("ApprovingDate", "Approving Date");
                Candidate_FieldLabelDict.Add("OnBoarding", "OnBoarding");
                Candidate_FieldLabelDict.Add("OnBoardingRemarks", "OnBoarding Remarks");
                Candidate_FieldLabelDict.Add("CICSanctionRequestDate", "CIC Sanction RequestDate");
                Candidate_FieldLabelDict.Add("TrainingResultCC", "Training Result CC");
                Candidate_FieldLabelDict.Add("CheckChannel", "Check Channel");
                Candidate_FieldLabelDict.Add("BatchFileID", "Batch File ID");

                Candidate_FieldLabelDict.Add("Role", "Role");
                Candidate_FieldLabelDict.Add("Level", "Level");
                Candidate_FieldLabelDict.Add("Category", "Category");
                Candidate_FieldLabelDict.Add("ProductCategory", "ProductCategory");
                Candidate_FieldLabelDict.Add("Product", "Product");
                Candidate_FieldLabelDict.Add("TeamLeaderCode", "Team Leader Code");
                Candidate_FieldLabelDict.Add("JoiningDate", "Joining Date");
                Candidate_FieldLabelDict.Add("PromotionTransferDate", "Promotion Transfer Date");
                Candidate_FieldLabelDict.Add("Status", "Status");
                Candidate_FieldLabelDict.Add("FingerID", "Finger ID");
                Candidate_FieldLabelDict.Add("PersonalTaxCode", "Personal Tax Code");
                Candidate_FieldLabelDict.Add("ContractType", "ContractT ype");
                Candidate_FieldLabelDict.Add("ContractTerm", "Contract Term");
                Candidate_FieldLabelDict.Add("ContractorName", "Contractor Name");
                Candidate_FieldLabelDict.Add("ContractSignDate", "Contract Sign Date");
                Candidate_FieldLabelDict.Add("ContractExpiryDate", "Contract Expiry Date");
                Candidate_FieldLabelDict.Add("BankAccount", "Bank Account");
                Candidate_FieldLabelDict.Add("BankBranchAddress", "Bank Branch/Address");
                Candidate_FieldLabelDict.Add("BankName", "Bank Name");
                Candidate_FieldLabelDict.Add("FillingRefCode", "Filling Ref Code");
                Candidate_FieldLabelDict.Add("ProfressiveTarget", "Profressive Target");
            }
            catch (Exception ex) { throw ex; }
        }
    }
}
